package com.tienon.message.Test;




import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import javax.annotation.Resource;
import org.junit.Test;
import org.springframework.stereotype.Component;

import com.tienon.message.service.Batch_mainService;
import com.tienon.message.service.Batch_mainThread;

@Component
public class Batch_mainTestService extends UnitTestEnv{
	
	@Resource
	Batch_mainService batch_mainService;
	/*@Resource
	Batch_mainMapper batch_mainMapper;
	@Test
	public void getMessage() throws ParseException{
		System.out.println("==============================");
		//System.out.println(batch_mainMapper);
		Batch_main batch_main = batch_mainMapper.selectByStep();
		System.out.println(batch_main.getFileName());
		System.out.println("==============================");
	}*/
	
	@Test
	public void Batch_mainControl() throws InterruptedException{
	    ExecutorService executor = Executors.newFixedThreadPool(1);//启动线程池,线程池大小为10
	    for(int i = 0;i < 1;i++){
	    	Runnable batch_main = new Thread(new Batch_mainThread(batch_mainService));
	    	System.err.println(batch_main);
	    	executor.execute(batch_main);
	    }
	    while(true){
	    	if(!executor.isTerminated()){
	    		Thread.sleep(100);
	    	}
	    }
	}
}
